package com.yilijk.base.network;

import androidx.annotation.NonNull;

import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author: cenjunlei
 * @date: 2021/7/27 10:17
 * @desc: 请求参数
 */
public class RequestParams extends JSONObject {

    public RequestParams() {
    }

    public RequestParams(@NonNull String json) throws JSONException {
        super(json);
    }

    @NotNull
    @Override
    public JSONObject put(String name, boolean value) {
        try {
            return super.put(name, value);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return this;
    }

    @NotNull
    @Override
    public JSONObject put(String name, double value) {
        try {
            return super.put(name, String.valueOf(value));
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return this;
    }

    @NotNull
    @Override
    public JSONObject put(String name, int value) {
        try {
            return super.put(name, String.valueOf(value));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return this;
    }

    @NotNull
    @Override
    public JSONObject put(String name, long value) {
        try {
            return super.put(name, String.valueOf(value));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return this;
    }

    @NotNull
    @Override
    public JSONObject put(String name, Object value) {
        try {

            return super.put(name, value);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return this;
    }

    @NotNull
    @Override
    public JSONObject putOpt(String name, Object value) {
        try {
            return super.putOpt(name, value);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return this;
    }


}
